You can rename a file or directory in Node.js using the fs.rename() method. Here's an example:
fs.rename()